package com.project.handle.travelHandle;

import com.project.handle.RiskHandle;
import com.project.pojo.RiskController;
import com.project.utils.ErrorMessage;
import com.project.utils.GetRiskCode;
import com.project.vo.TripAccessVO;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
@Order(1)
public class TravelHandleOfAge implements RiskHandle<TripAccessVO> {

    @Override
    public void RiskAssess(TripAccessVO tripAccessVO, List<RiskController> list, List<ErrorMessage> errorMessageList) {
        int age = tripAccessVO.getAge();
        String match = "";
        if (age>=50){
            match="大于50";
        }else if (age<50&&age>=18){
            match="小于50大于18";
        }else {
            match="小于18";
        }
        int nowweight = GetRiskCode.getCode(match, list);
        tripAccessVO.setWeight(nowweight+ tripAccessVO.getWeight());
    }
}
